home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Software Vault: The Gold Collection
/
Software Vault - The Gold Collection (American Databankers) (1993).ISO
/
cdr26
/
env_30.zip
/
ENVIRON.DOC
< prev
next >
Wrap
Text File
|
1993-05-01
|
26KB
|
530 lines
█████████ ███ ███ ███ ███ ███ ████████ ███████ ███ ███
███▒▒▒▒▒▒▒ ████ ███▒ ███▒ ███▒ ███▒ ███▒▒▒███ ███▒▒▒███ ████ ███▒
███▒ █████ ███▒ ███▒ ███▒ ███▒ ███▒ ███▒ ███▒ ███▒ █████ ███▒
████████ ███▒█▒███▒ ███▒ ███▒ ███▒ ████████▒▒ ███▒ ███▒ ███▒█▒███▒
███▒▒▒▒▒▒ ███▒█████▒ ███ ███▒▒ ███▒ ███▒███▒▒ ███▒ ███▒ ███▒█████▒
███▒ ███▒ ████▒ ███▒███▒ ███▒ ███▒ ███ ███▒ ███▒ ███▒ ████▒
█████████ ███▒ ███▒ ▒███▒▒▒ ███▒ ███▒ ███ ███████▒▒ ███▒ ███▒
▒▒▒▒▒▒▒▒▒ ▒▒▒ ▒▒▒ ▒▒▒ ▒▒▒ ▒▒▒ ▒▒▒ ▒▒▒▒▒▒▒ ▒▒▒ ▒▒▒
Version 3.0
May 1, 1993
Copyright 1992, 93 by David E. Key
Arlington, Texas
CompuServe 76264,1532
TABLE OF CONTENTS
_____________________________________________________________________
INTRODUCTION . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3
OVERVIEW . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3
CHAPTER 1 - SYSTEM REQUIREMENTS. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4
HARDWARE . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4
A NOTE ON VIDEO. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4
CHAPTER 2 - EXECUTION. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5
USER SELECTED. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5
Delete . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5
Delete with Configuration File . . . . . . . . . . . . . . . . . . . . . . . . . 6
User Specified Delete. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6
Restore. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
AUTOMATIC. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
Delete . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
Delete with Configuration File . . . . . . . . . . . . . . . . . . . . . . . . . 8
User Specified Delete. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8
Restore. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8
CHAPTER 3 - COMMAND LINE PARAMETERS. . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
DESCRIPTION. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
AVAILABLE COMBINATIONS . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
CHAPTER 4 - RELATED FILES. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11
SAVED ENVIRONMENT FILE . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11
CONFIGURATION FILE . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11
CHAPTER 5 - LIMITATIONS. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11
INTRODUCTION
_____________________________________________________________________
ENVIRON was written to solve the problem of network administrators adding an
onerous number of environment variables to user's PC's with their own harddisk
and battery of applications. In our shop, the menu system we use adds about 10
variables that take up approximately 200 bytes. In addition to managing the
woes created by your friendly network administrator, ENVIRON can also be used
to manage different scenarios where applications need there own subset of
environment variables either to run or to run more efficiently. The program is
designed for use in batch files once the user becomes comfortable with the
workings by using the "automatic" mode. Using a little creativity, you should
find it quite easy to accomplish just about anything that has to do with these
little critters.
If you find ENVIRON useful, a gift of any amount would be appreciated. There
is no warranty of any kind. The copyright owner does not warrant that the
software will meet your requirements or that it is error free, nor may the
copyright owner be help responsible for any loss of profits or data. Whether
you like the software or not, I would appreciate any comments related to
problems you're having or suggestions for improvement. Please address all
correspondence to:
David E. Key
6018 Lakehurst Court
Arlington, TX 76016-1024
OVERVIEW
_____________________________________________________________________
ENVIRON is a utility that can be used to delete selected variables from the DOS
master environment, storing those selected to a file before it does so. It can
also be used to restore these saved variables, or a selected subset thereof to
the master environment. There are two modes of operation; "user selected" and
"automatic".
"User selected" presents a screen showing the variables, and offering the user
the opportunity to mark them for deletion or restoration. There are several
options within this mode that can be specified via command line parameters.
Discussion of these is deferred to the following chapters.
"Automatic" simply runs the program "silently" (i.e. no screens are presented
or messages are printed as long as execution completes successfully). If
execution is completed successfully a value of 0 is returned to DOS upon
termination. Otherwise a value of 1 is returned. This mode also provides for
several command line parameters.
CHAPTER 1 - SYSTEM REQUIREMENTS
_____________________________________________________________________
HARDWARE
--------------------------------------------------------------------------
The ENVIRON.EXE program requires about 95K of memory. It was developed and
tested exclusively under MS-DOS 5.00. How it will behave under another operat-
ing system, I have no idea. However, because of the method used to "grab" the
master environment, I feel fairly comfortable that it should not be a problem.
The code is written in C++ and should run on anything greater than or equal to
an 80x86. There are no floating point routines, so performance with a coproc-
essor is moot. Disk size is certainly no issue. The only additional file
space required by the program is exactly equal to the size in bytes of the
variables removed from the environment.
A NOTE ON VIDEO
--------------------------------------------------------------------------
ENVIRON writes directly to video memory in "user selected" mode and uses the
following steps to determine what that address should be. First, the mode is
tested and if it is not equal to 7 the address is set to B800h. If the mode is
7, the address used is B000h. If the mode is equal to 3, color is added,
otherwise text is presented in black and white. If you experience video
problems it can probably be traced to the above. "Automatic" mode uses no
video except upon error such as being unable to find the saved environment
file, or being unable to change directories.
CHAPTER 2 - EXECUTION
_____________________________________________________________________
USER SELECTED
--------------------------------------------------------------------------
Delete
------
In "user selected" delete mode a screen similar to the following example
is presented:
▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒ DELETE MODE ▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒
╔═════════════════════════════════════════════════════════════════════════════╗
║ ENVIRON.EXE ║
║ Environment Manipulation Utility ║
║ Version 3.0 ║
╚═════════════════════════════════════════════════════════════════════════════╝
√ PROMPT=$P$G
√ TIGA=-MC:\TIGA -LC:\TIGA
√ CLIPPER=F65,R26,V022,E0,X64
√ RIMID=C6
√ COMSPEC=C:\COMMAND.COM
√ PATH=C:\;C:\DOS5;C:\PCTOOLS;C:\UTIL;C:\XTGOLD;C:\BORLANDC\BIN;C:\NORTON; ...
√ S_1=Home
√ S_2=of
√ S_3=the
√ S_4=free
√ S_5=and
┌──────────────────────────────────────────────────────┐
│ Use arrow keys () to highlight item █ F7 to mark │
│ / unmark █ F2 to write selected variables to file │
│ and remove from environment █ F10 to abort operation │
└──────────────────────────────────────────────────────┘
▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓ PGDN / PGUP for more ... ▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓
The top line of the screen provides information on the mode of operation.
In this case, "DELETE MODE". The available keys are listed in the out-
lined box near the bottom of the screen. Not shown here, but obvious in
the program, the currently selected item is highlighted in BLACK on
LIGHTGRAY. The arrow keys can be used to move up and down the list of
selections. Those items that are marked with a "√" character are "select-
ed". Selection can be toggled on and off by pressing the F7 key. In this
mode all items are selected by default when the program is started. If
there are more than 11 variables in the environment, a message is dis-
played on the bottom of the screen stating that PGDN or PGUP can be
pressed to view the next (or previous) screen of variables. If any one
variable is greater than 74 characters in length, it is displayed with 3
trailing dots (...). Not to worry, this is merely for cosmetics, the true
value is still "in there." However, you would probably think that a good
program would let you use the right and left arrow keys to view the rest
of it. Unfortunately, this isn't one of those kind of "good ones." Once
all selections have been made, F2 can be pressed to write out the selected
variables to the "save" file and to remove them from the environment. Of
course, there is an abort key ... pressing F10 at any time discards all
changes and returns you to DOS. No changes are made in this instance.
Delete with Configuration File
------------------------------
In "user selected" delete with configuration file mode the screen appears
exactly the same as that for "user selected" delete mode except that the
items specified in the configuration file are rendered unselectable.
Their status is noted on color displays in DARKGRAY on BLUE. On non-color
monitors their colors are LIGHTGRAY on BLACK. It is impossible to over-
ride their status because the arrow keys cannot be used to highlight them.
The top line of screen indicates "RESTRICTED DELETE MODE".
User Specified Delete
---------------------
This mode should not be confused with "user selected" delete mode. In
this mode, wildcard parameters are given that specify which variables
should be marked for deletion by default as opposed to which variables
should NOT be deleted, or selecting them all. Once again, the screen
appears exactly the same as that for "user selected" delete mode except
that the items matching the wildcard parameters are marked for deletion
with those not matching not being marked. All items are available for
marking/unmarking in this mode. The top line of screen indicates "DELETE
MODE".
The wildcard parameters follow the same form as those used by MS-DOS when
specifying file names to be acted upon by the operating system. The
exception to this is that the "?" character is not supported. If this
character is used, ENVIRON will search for it explicitly in the list of
environment variables. The "*" is supported in one instance only per
wildcard parameter and may occur anywhere in the string. Each wildcard
parameter MUST be separated by one space and should follow a SINGLE "/S:"
parameter. A space after the initial "/S:" specifier is optional. Some
examples:
The parameter "AS*" would find:
ASCII
ASKME
ASTER
it would NOT find:
FAST
RASTER
The parameter "*ED" would find:
ACTED
SUPPORTED
SEPARATED
it would NOT find:
MEDELY
BEDS
The parameter "FILE*BIG" would find:
FILE01BIG
FILE02BIG
it would not find:
FIL001BIG
FIL002BIG
Restore
-------
In "user selected" delete mode a screen similar to the following example
is presented:
▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒ RESTORE MODE ▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒
╔═════════════════════════════════════════════════════════════════════════════╗
║ ENVIRON.EXE ║
║ Environment Manipulation Utility ║
║ Version 3.0 ║
╚═════════════════════════════════════════════════════════════════════════════╝
√ NU=C:\NORTON
√ S_FILEDIR=Z:\STATION\C6\
√ S_FILE=49
√ S_LOGIN=DAVID
√ S_DRIVE=F:
√ OS=MSDOS
√ VER=V5.00
√ S_DOS=V5.00
√ S_MENU=RISKMAIN
√ S_PROJECT=RISK_MANAGEMENT
√ PRT_GROUP=RISK_PRT
┌──────────────────────────────────────────────────────┐
│ Use arrow keys () to highlight item █ F7 to │
│ mark / unmark █ F2 to insert selected variables │
│ into environment █ F10 to abort operation │
└──────────────────────────────────────────────────────┘
▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓ PGDN / PGUP for more ... ▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓
The screen appears exactly the same as that for "user selected" delete
mode except that the F2 key restores the saved environment variables to
the master environment. All other keys perform the same function as that
described above. It should be noted that if all variables from the file
are not restored, those excluded are lost forever. An ASCII file of the
same format could be created to restore these variables later if so
desired.
AUTOMATIC
--------------------------------------------------------------------------
Delete
------
"Automatic" delete mode performs the same function as "user selected"
delete mode except that no operator intervention is required or allowed.
Unless some sort of unusual error occurs such as being unable to find a
specified directory or file, operation proceeds "silently" and a value of
0 is returned to DOS upon completion. If an error occurs a value of 1 is
returned to DOS. As with "user selected" delete, the default is to delete
all variables from the environment. This is probably not the desired
effect so "automatic" delete with configuration file mode is provided to
retain those variables contained in the configuration file.
Delete with Configuration File
------------------------------
"Automatic" delete with configuration file mode operates the same as its
"user selected" cousin except that no operator intervention is required or
allowed. Unless some sort of unusual error occurs such as being unable to
find a specified directory or file, operation proceeds "silently" and a
value of 0 is returned to DOS upon completion. If an error occurs a value
of 1 is returned to DOS. As with the "user selected" mode, the default is
to delete all variables from the environment except those contained in the
configuration file.
User Specified Delete
---------------------
"Automatic" user specified delete mode operates the same as its "user
selected" cousin except that no operator intervention is required or
allowed. Unless some sort of unusual error occurs such as being unable to
find a specified directory or file, operation proceeds "silently" and a
value of 0 is returned to DOS upon completion. If an error occurs a value
of 1 is returned to DOS. As with the "user selected" mode, the default is
to delete all variables from the environment that match the wildcard
parameters specified on the command line.
Restore
-------
"Automatic" restore mode performs the same function as "user selected"
restore mode except that no operator intervention is required or allowed.
Unless some sort of unusual error occurs such as being unable to find a
specified directory or being unable to find the saved environment file,
operation proceeds "silently" and a value of 0 is returned to DOS upon
completion. If an error occurs a value of 1 is returned to DOS. As with
"user selected" restore, the default is to restore all variables to the
environment. If this is not the desired effect, the saved environment
file could be edited to include only those needed.
CHAPTER 3 - COMMAND LINE PARAMETERS
_____________________________________________________________________
DESCRIPTION
--------------------------------------------------------------------------
Usage:
C:\>ENVIRON </D|/R[-(save file]|/S:<wildcard(s)>> /C[-(config file] /A /H
Available Parameters:
/H - Display online help screens.
/D[-(save file] - Delete variables from the environment optionally spec-
ifying where to save the variables removed from the
environment. Or, in combination with the "/S" parame-
ter, specify where to save the environment variables.
/C[-(config file] - Use configuration file to specify those variables that
should be excluded from deletion, optionally specify-
ing where to find the configuration file.
/S:<wildcard(s)> - Delete all variables that match a specified pattern
using the familiar DOS "*" wildcard character. Multi-
ple patterns can be specified by separating them with
one space. Use in combination with "/D" to specify
where the variables removed from the environment
should be stored
/R[-(save file] - Restore saved variables to the environment, optionally
specifying where to find the saved file if other than
default.
/A - Automatic mode, no user intervention required or al-
lowed.
AVAILABLE COMBINATIONS
--------------------------------------------------------------------------
--------------------------------| /H |----------------------------------
Display online HELP screens.
--------------------------| /D[-(save file] |----------------------------
User selected DELETE mode, default is delete all. Optional file name specifies
the drive, path, and name of the file in which to save the variables removed
from the environment. By default this file is saved in the root directory of
the drive on which ENVIRON.EXE resides, unless overridden.
----------------| /D[-(save file] /C[-(config file] |-------------------
User selected DELETE mode, default excludes those variables specified in the
configuration file. The optional, "/D" "save file" parameter functions the
same as outlined above under "/D[-(save file]". Optional "config file"
specifies the drive, path, and name of the configuration file. By default the
configuration file is searched for in the same directory ENVIRON.EXE is stored
in, unless overridden.
-----------------------| /D[-(save file] /A |---------------------------
Automatic DELETE mode, default is delete all. The optional, "/D" "save file"
option functions the same as outlined above under "/D[-(save file]". This is
not a recommended combination as it will nuke everything in your environment.
--------------| /D[-(save file] /C[-(config file] /A |------------------
Automatic DELETE mode, default excludes those contained in the configuration
file. The optional, "/D" "save file" and "/C" "config file" parameters
function the same as outlined above under "/D[-(save file] /C[-(config file]".
------------------------| /S:<wildcards(s)> |---------------------------
User specified DELETE mode. Deletes only those variables matching the pat-
tern(s) specified as wildcard(s). All wildcard patterns must follow the first
and only "/S:". Subsequent wildcard patterns (after the first) must have 1 and
only 1 space separating them.
----------------------| /S:<wildcards(s)> /A |--------------------------
Automatic DELETE mode. Deletes only those variables matching the pattern(s)
specified as wildcard(s). All wildcard patterns must follow the first and only
"/S:". Subsequent wildcard patterns (after the first) must have 1 and only 1
space separating them.
------------------| /S:<wildcards(s)> /D[-(save file] |-----------------
User selected DELETE mode. "/S:" "wildcard(s)" parameter functions the same as
outlined above under "/S:<wildcards(s)>". The "/D" "save file" parameter
serves only to specify the location for storing the saved environment file.
-----------------| /S:<wildcards(s)> /D[-(save file] /A |---------------
Automatic DELETE mode. Functions the same as outlined above under "/S:<wild-
cards(s)> /D[-(save file]".
-------------------------| /R[-(save file] |----------------------------
User selected RESTORE mode, default is restore all variables contained in the
saved environment file. Optional file name specifies the drive, path, and name
of the file in which the variables removed from the environment are saved. By
default this file is saved in the root directory of the drive on which
ENVIRON.EXE resides, unless overridden. The "save file" option MUST be used if
the environment variables were saved in any location other than the default.
-----------------------| /R[-(save file] /A |---------------------------
Automatic RESTORE mode. Restores all variables contained in the saved environ-
ment file. The optional "save file" specifier function the same, and with the
same requirements as outlined under "/R[-(save file]".
The sequence of these parameters on the command line is insignificant.
Specification of individual parameters must be separated by at least one
space.
CHAPTER 4 - RELATED FILES
_____________________________________________________________________
SAVED ENVIRONMENT FILE
--------------------------------------------------------------------------
Upon executing ENVIRON in any of the delete modes a file entitled
SAVEDENV.TXT is written to the root directory of the disk on which
ENVIRON.EXE resides unless overridden using the "-(save file" option (see
description above). This is a flat, ASCII file that writes each variable
and its associated value (separated by an "=" sign) to its own line in the
file. This file can be edited with a text editor, deleting or adding
lines as desired. Just be sure to follow the same format as that found in
the file created by ENVIRON itself. Each time this file is written a
header precedes the variables identifying it as an ENVIRON.EXE byproduct.
If the resulting file contains no variables it will still be saved to disk
with the header line being its only contents. This allows ENVIRON to
execute in automatic mode without displaying an error message when a
restore is attempted and there is really nothing for ENVIRON to do.
CONFIGURATION FILE
--------------------------------------------------------------------------
A copy of an example configuration file should be included with this
distribution and is entitled ENVIRON.CFG. It must reside in the same
directory as ENVIRON.EXE. Basically, variables to exclude are listed on
individual lines WITHOUT the associated "=" sign or the variable's pur-
ported contents. Comments can be added by placing a semicolon anywhere on
the line.
CHAPTER 5 - LIMITATIONS
_____________________________________________________________________
There are several limitations in the program worth mentioning. First, the
number of environment variables that the program can handle is limited to 64.
In User Selected Delete Mode, the maximum number of wildcard combinations
following the "/S:" parameter is 15. And finally, environment variables
greater than 128 characters in length are not supported.
One "quirk" I have found, and still don't know the reason for, relates to
deleting the "COMSPEC" variable from the environment. The variable is not
visible after using the DOS "SET" command, and restores without problem. But,
shortly after that some or all of the environment variables disappear when
other applications are used. For this reason I would strongly suggest that you
NOT delete the "COMSPEC" variable.